;#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
Persistent
#SingleInstance
SendMode "Input"  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir A_ScriptDir  ; Ensures a consistent starting directory.
SetKeyDelay 0
SetWinDelay 0
;SetBatchLines 0
SetControlDelay 0
SetTitleMatchMode 2
if not A_IsAdmin
{
	Run "*RunAs " A_ScriptFullPath
}
OnExit App.Exit
!+f4::ExitApp
^f5::
{
	RunWait("netsh advfirewall firewall add rule name=`"BATCH GTA 5 BLOCK`" dir=out action=block" ,,"Hide")
	RunWait("netsh advfirewall firewall add rule name=`"BATCH GTA 5 BLOCK`" dir=in action=block" ,,"Hide")
	ToolTip("网络已禁用", 0, 0)
	return
}


^f6::
{
	RunWait("netsh advfirewall firewall delete rule name=`"BATCH GTA 5 BLOCK`"" ,,"Hide")
	ToolTip("网络已恢复", 0, 0)
	Sleep(3000)
	ToolTip(, 0, 0)
	return
}


^f9::
{
	RunWait("netsh advfirewall firewall add rule name=`"GTA5 SAVEMODE`" dir=out action=block remoteip=`"192.81.241.171`"" ,,"Hide")
	ToolTip("保存模式：已禁用", 10, 10)

return
}


^f12::
{
	RunWait("netsh advfirewall firewall delete rule name=`"GTA5 SAVEMODE`"" ,,"Hide")
	ToolTip("保存模式：已恢复", 10, 10)
	Sleep(3000)
	Tooltip(, 0, 0)
return
}


^f8::
{
	Tooltip(
	 "Ctrl + F5 - 禁止游戏联网`n" 
	 "Ctrl + F6 - 恢复游戏联网`n"
	 "Ctrl + F9 - 禁用保存模式`n" 
	 "Ctrl + F12 - 恢复保存模式"
	, 0, 0)
Sleep 5000
Tooltip(, 0, 0)
return
}


;scripts
class App
{
    static Exit(*)
    {
        RunWait("netsh advfirewall firewall delete rule name=`"BATCH GTA 5 BLOCK`"" ,,"Hide")
		RunWait("netsh advfirewall firewall delete rule name=`"GTA5 SAVEMODE`"" ,,"Hide")
    }
}